/*** Eclipse Class Decompiler plugin, copyright (c) 2012 Chao Chen (cnfree2000@hotmail.com) ***/
package com.qihoo.gamecenter.sdk.pay.j;

import android.content.Context;
import android.text.TextUtils;
import com.qihoo.gamecenter.sdk.common.h.d;
import com.qihoo.gamecenter.sdk.common.h.d.a;
import com.qihoo.gamecenter.sdk.common.i.s;
import com.qihoo.gamecenter.sdk.pay.e.a;
import com.qihoo.gamecenter.sdk.pay.k.c;
import java.util.Map;
import java.util.TreeMap;
import org.json.JSONObject;

public class f extends d {
    public f(Context paramContext, d.a parama) {
        super(paramContext, parama, true);
    }

    protected String a(Context paramContext, String[] paramArrayOfString) {
        return null;
    }

    protected String a() {
        return "http://mgame.360.cn/bankpay/query_card_no.json";
    }

    protected boolean b() {
        return true;
    }

    protected Map b(Context paramContext, String[] paramArrayOfString) {
        return c(paramContext, paramArrayOfString);
    }

    private Map c(Context paramContext, String[] paramArrayOfString) {
        String str1 = a(0, paramArrayOfString);
        if (TextUtils.isEmpty(str1)) {
            c.b("MMCheckCardNumTask", new Object[] { "CheckCardNum: qihooId is null!" });
            return null;
        }
        String str2 = a(1, paramArrayOfString);
        if (TextUtils.isEmpty(str2)) {
            c.b("MMCheckCardNumTask", new Object[] { "CheckCardNum: access token is null!" });
            return null;
        }
        String str3 = a(2, paramArrayOfString);
        if (TextUtils.isEmpty(str3)) {
            c.b("MMCheckCardNumTask", new Object[] { "CheckCardNum: card number is null!" });
            return null;
        }
        TreeMap localTreeMap = new TreeMap();
        localTreeMap.put("user_id", str1);
        localTreeMap.put("app_key", s.r(paramContext));
        localTreeMap.put("access_token", str2);
        String str4 = com.qihoo.gamecenter.sdk.pay.e.b.a(paramContext, null, str3, null);
        if (!(TextUtils.isEmpty(str4)))
            localTreeMap.put("quick_info", str4);
        String str5 = com.qihoo.gamecenter.sdk.pay.e.b.b(paramContext);
        c.a("MMCheckCardNumTask", new Object[] { "riskControl=", str5 });
        if (!(TextUtils.isEmpty(str5)))
            localTreeMap.put("risk_control", str5);
        String str6 = s.a(localTreeMap, s.s(paramContext));
        c.a("MMCheckCardNumTask", new Object[] { "params=", str6 });
        if (b()) {
            this.a = s.b();
            String str7 = com.qihoo.gamecenter.sdk.common.i.f.c(str6, this.a);
            String str8 = com.qihoo.gamecenter.sdk.common.f.b.a().a(this.a);
            localTreeMap = new TreeMap();
            localTreeMap.put("k", str8);
            localTreeMap.put("d", str7);
            c.a("MMCheckCardNumTask", new Object[] { a(), "?k=", str8, "&d=", str7 });
        }
        return localTreeMap;
    }

    protected a b(JSONObject paramJSONObject) {
        if (paramJSONObject != null) {
            a locala = new a();
            a.a(locala, paramJSONObject.optInt("error_code", -1));
            a.a(locala, paramJSONObject.optString("error"));
            if (TextUtils.isEmpty(a.a(locala)))
                a.a(locala, paramJSONObject.optString("error_msg"));
            if (locala.b())
                a.a(locala, paramJSONObject);
            return locala;
        }
        return null;
    }

    public static class a {
        private int a = -1;
        private String b;
        private a c;

        public a a() {
            return this.c;
        }

        public boolean b() {
            return (this.a == 0);
        }

        public int c() {
            return this.a;
        }

        public String d() {
            return this.b;
        }

        private boolean a(JSONObject paramJSONObject) {
            this.c = new a();
            String str1 = paramJSONObject.optString("cardtype");
            String str2 = paramJSONObject.optString("channel_type");
            if ((TextUtils.isEmpty(str1)) || (TextUtils.isEmpty(str2)))
                return false;
            this.c.e(paramJSONObject.optString("bank"));
            this.c.f(paramJSONObject.optString("bank_type"));
            String str3 = paramJSONObject.optString("card_no");
            this.c.d(paramJSONObject.optString("cardlastno"));
            this.c.g(str3);
            if ((TextUtils.isEmpty(this.c.g())) && (!(TextUtils.isEmpty(str3))))
                this.c.d(str3.substring(str3.length() - 4));
            this.c.d(paramJSONObject.optLong("max_money ", 9223372036854775807L));
            this.c.i(str1);
            this.c.h(str2);
            this.c.b(paramJSONObject.optInt("active"));
            this.c.a(paramJSONObject.optInt("highrisk"));
            this.c.a(paramJSONObject.optString("sub_bank_code"));
            this.c.a(paramJSONObject.optJSONArray("ui_fields"));
            c.a("MMCheckCardNumTask", new Object[] { "@CheckCard: ", this.c.toString() });
            return true;
        }
    }
}